home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / gnu / nethack.lha / nethack-3.1 / src / drawing.c < prev    next >
C/C++ Source or Header  |  1993-01-25  |  19KB  |  711 lines

  1. /*    SCCS Id: @(#)drawing.c    3.1    92/12/20    */
  2. /* Copyright (c) NetHack Development Team 1992.              */
  3. /* NetHack may be freely redistributed.  See license for details. */
  4.  
  5. #include "hack.h"
  6. #include "termcap.h"
  7.  
  8. /* Relevent header information in rm.h and objclass.h. */
  9.  
  10. #ifdef C
  11. #undef C
  12. #endif
  13.  
  14. #ifdef TEXTCOLOR
  15. #define C(n) n
  16. #else
  17. #define C(n)
  18. #endif
  19.  
  20. #define g_FILLER(symbol) 0
  21.  
  22. uchar oc_syms[MAXOCLASSES] = DUMMY; /* the current object  display symbols */
  23. uchar showsyms[MAXPCHARS]  = DUMMY; /* the current feature display symbols */
  24. uchar monsyms[MAXMCLASSES] = DUMMY; /* the current monster display symbols */
  25.  
  26. /* Default object class symbols.  See objclass.h. */
  27. const char def_oc_syms[MAXOCLASSES] = {
  28. /* 0*/    '\0',        /* placeholder for the "random class" */
  29.     ILLOBJ_SYM,
  30.     WEAPON_SYM,
  31.     ARMOR_SYM,
  32.     RING_SYM,
  33. /* 5*/    AMULET_SYM,
  34.     TOOL_SYM,
  35.     FOOD_SYM,
  36.     POTION_SYM,
  37.     SCROLL_SYM,
  38. /*10*/    SPBOOK_SYM,
  39.     WAND_SYM,
  40.     GOLD_SYM,
  41.     GEM_SYM,
  42.     ROCK_SYM,
  43. /*15*/    BALL_SYM,
  44.     CHAIN_SYM,
  45.     VENOM_SYM
  46. };
  47.  
  48. /* Object descriptions.  Used in do_look(). */
  49. const char *objexplain[] = {    /* these match def_oc_syms, above */
  50. /* 0*/    0,
  51.     "strange object",
  52.     "weapon",
  53.     "suit or piece of armor",
  54.     "ring",
  55. /* 5*/    "amulet",
  56.     "useful item (pick-axe, key, lamp...)",
  57.     "piece of food",
  58.     "potion",
  59.     "scroll",
  60. /*10*/    "spell book",
  61.     "wand",
  62.     "pile of coins",
  63.     "gem or rock",
  64.     "boulder or statue",
  65. /*15*/    "iron ball",
  66.     "iron chain",
  67.     "splash of venom"
  68. };
  69.  
  70. /* Object class names.  Used in object_detect(). */
  71. const char *oclass_names[] = {
  72. /* 0*/    0,
  73.     "illegal objects",
  74.     "weapons",
  75.     "armor",
  76.     "rings",
  77. /* 5*/    "amulets",
  78.     "tools",
  79.     "food",
  80.     "potions",
  81.     "scrolls",
  82. /*10*/    "spell books",
  83.     "wands",
  84.     "coins",
  85.     "rocks",
  86.     "large stones",
  87. /*15*/    "iron balls",
  88.     "chains",
  89.     "venoms"
  90. };
  91.  
  92. /* Default monster class symbols.  See monsym.h. */
  93. const char def_monsyms[MAXMCLASSES] = {
  94.     '\0',        /* holder */
  95.     DEF_ANT,
  96.     DEF_BLOB,
  97.     DEF_COCKATRICE,
  98.     DEF_DOG,
  99.     DEF_EYE,
  100.     DEF_FELINE,
  101.     DEF_GREMLIN,
  102.     DEF_HUMANOID,
  103.     DEF_IMP,
  104.     DEF_JELLY,        /* 10 */
  105.     DEF_KOBOLD,
  106.     DEF_LEPRECHAUN,
  107.     DEF_MIMIC,
  108.     DEF_NYMPH,
  109.     DEF_ORC,
  110.     DEF_PIERCER,
  111.     DEF_QUADRUPED,
  112.     DEF_RODENT,
  113.     DEF_SPIDER,
  114.     DEF_TRAPPER,        /* 20 */
  115.     DEF_UNICORN,
  116.     DEF_VORTEX,
  117.     DEF_WORM,
  118.     DEF_XAN,
  119.     DEF_LIGHT,
  120.     DEF_ZRUTY,
  121.     DEF_ANGEL,
  122.     DEF_BAT,
  123.     DEF_CENTAUR,
  124.     DEF_DRAGON,        /* 30 */
  125.     DEF_ELEMENTAL,
  126.     DEF_FUNGUS,
  127.     DEF_GNOME,
  128.     DEF_GIANT,
  129.     DEF_STALKER,
  130.     DEF_JABBERWOCK,
  131.     DEF_KOP,
  132.     DEF_LICH,
  133.     DEF_MUMMY,
  134.     DEF_NAGA,        /* 40 */
  135.     DEF_OGRE,
  136.     DEF_PUDDING,
  137.     DEF_QUANTMECH,
  138.     DEF_RUSTMONST,
  139.     DEF_SNAKE,
  140.     DEF_TROLL,
  141.     DEF_UMBER,
  142.     DEF_VAMPIRE,
  143.     DEF_WRAITH,
  144.     DEF_XORN,        /* 50 */
  145.     DEF_YETI,
  146.     DEF_ZOMBIE,
  147.     DEF_HUMAN,
  148.     DEF_GHOST,
  149.     DEF_GOLEM,
  150.     DEF_DEMON,
  151.     DEF_EEL,
  152.     DEF_LIZARD,
  153.     DEF_WORM_TAIL,
  154.     DEF_MIMIC_DEF,        /* 60 */
  155. };
  156.  
  157. const char *monexplain[MAXMCLASSES] = {
  158.     0,
  159.     "ant or other insect",    "blob",            "cockatrice",
  160.     "dog or other canine",    "eye or sphere",    "feline",
  161.     "gremlin",            "humanoid",        "imp or minor demon",
  162.     "jelly",            "kobold",        "leprechaun",
  163.     "mimic",            "nymph",        "orc",
  164.     "piercer",            "quadruped",        "rodent",
  165.     "spider",            "trapper or lurker above", "unicorn",
  166.     "vortex",        "worm", "xan or other mythical/fantastic insect",
  167.     "light",            "zruty",
  168.  
  169.     "angelic being",        "bat",            "centaur",
  170.     "dragon",            "elemental",        "fungus or mold",
  171.     "gnome",            "giant humanoid",    "invisible stalker",
  172.     "jabberwock",        "Keystone Kop",        "lich",
  173.     "mummy",            "naga",            "ogre",
  174.     "pudding or ooze",        "quantum mechanic",    "rust monster",
  175.     "snake",            "troll",        "umber hulk",
  176.     "vampire",            "wraith",        "xorn",
  177.     "yeti, ape or other large beast", "zombie",
  178.  
  179.     "human",            "ghost",        "golem",
  180.     "demon",            "sea monster",        "lizard",
  181.     "long worm tail",        "mimic"
  182. };
  183.  
  184. /*
  185.  *  Default screen symbols with explanations and colors.
  186.  *  Note:  {ibm|dec|mac}_graphics[] arrays also depend on this symbol order.
  187.  */
  188. const struct symdef defsyms[MAXPCHARS] = {
  189. /* 0*/    {' ', "dark part of a room",C(NO_COLOR)},    /* stone */
  190.     {'|', "wall",        C(GRAY)},    /* vwall */
  191.     {'-', "wall",        C(GRAY)},    /* hwall */
  192.     {'-', "wall",        C(GRAY)},    /* tlcorn */
  193.     {'-', "wall",        C(GRAY)},    /* trcorn */
  194.     {'-', "wall",        C(GRAY)},    /* blcorn */
  195.     {'-', "wall",        C(GRAY)},    /* brcorn */
  196.     {'-', "wall",        C(GRAY)},    /* crwall */
  197.     {'-', "wall",        C(GRAY)},    /* tuwall */
  198.     {'-', "wall",        C(GRAY)},    /* tdwall */
  199. /*10*/    {'|', "wall",        C(GRAY)},    /* tlwall */
  200.     {'|', "wall",        C(GRAY)},    /* trwall */
  201.     {'.', "doorway",    C(GRAY)},    /* ndoor */
  202.     {'-', "open door",    C(BROWN)},    /* vodoor */
  203.     {'|', "open door",    C(BROWN)},    /* hodoor */
  204.     {'+', "closed door",    C(BROWN)},    /* vcdoor */
  205.     {'+', "closed door",    C(BROWN)},    /* hcdoor */
  206.     {'.', "floor of a room",C(GRAY)},    /* room */
  207.     {'#', "corridor",    C(GRAY)},    /* dark corr */
  208.     {'#', "lit corridor",    C(GRAY)},    /* lit corr */
  209. /*20*/    {'<', "staircase up",    C(GRAY)},    /* upstair */
  210.     {'>', "staircase down",    C(GRAY)},    /* dnstair */
  211.     {'<', "ladder up",    C(BROWN)},    /* upladder */
  212.     {'>', "ladder down",    C(BROWN)},    /* dnladder */
  213.     {'^', "trap",        C(RED)},    /* trap */
  214.     {'"', "web",        C(GRAY)},    /* web */
  215.     {'_', "altar",        C(GRAY)},    /* altar */
  216.     {'\\', "opulent throne",C(HI_GOLD)},    /* throne */
  217. #ifdef SINKS
  218.     {'#', "sink",        C(GRAY)},    /* sink */
  219. #else
  220.     {'#', "",        C(GRAY)},    /* sink */
  221. #endif
  222.     {'{', "fountain",    C(BLUE)},    /* fountain */
  223. /*30*/    {'}', "water filled area",C(BLUE)},    /* pool */
  224.     {'.', "ice",        C(CYAN)},    /* ice */
  225.     {'}', "molten lava",    C(RED)},    /* lava */
  226.     {'.', "lowered drawbridge",C(BROWN)},    /* vodbridge */
  227.     {'.', "lowered drawbridge",C(BROWN)},    /* hodbridge */
  228.     {'#', "raised drawbridge",C(BROWN)},    /* vcdbridge */
  229.     {'#', "raised drawbridge",C(BROWN)},    /* hcdbridge */
  230.     {' ', "air filled area",C(CYAN)},    /* open air */
  231.     {'#', "cloud filled area",C(GRAY)},    /* part of a cloud */
  232.     {'}', "water filled area",C(BLUE)},    /* under water */
  233. /*40*/    {'|', "wall",        C(GRAY)},    /* vbeam */
  234.     {'-', "wall",        C(GRAY)},    /* hbeam */
  235.     {'\\',"wall",        C(GRAY)},    /* lslant */
  236.     {'/', "wall",        C(GRAY)},    /* rslant */
  237.     {'*', "",        C(WHITE)},    /* dig beam */
  238.     {'!', "",        C(WHITE)},    /* camera flash beam */
  239.     {')', "",        C(HI_METAL)},    /* boomerang open left */
  240.     {'(', "",        C(HI_METAL)},    /* boomerang open right */
  241.     {'0', "",        C(HI_ZAP)},    /* 4 magic shield symbols */
  242.     {'#', "",        C(HI_ZAP)},
  243. /*50*/    {'@', "",        C(HI_ZAP)},
  244.     {'*', "",        C(HI_ZAP)},
  245.     {'/', "",        C(GREEN)},    /* swallow top left    */
  246.     {'-', "",        C(GREEN)},    /* swallow top center    */
  247.     {'\\', "",        C(GREEN)},    /* swallow top right    */
  248.     {'|', "",        C(GREEN)},    /* swallow middle left    */
  249.     {'|', "",        C(GREEN)},    /* swallow middle right    */
  250.     {'\\', "",        C(GREEN)},    /* swallow bottom left    */
  251.     {'-', "",        C(GREEN)},    /* swallow bottom center*/
  252.     {'/', "",        C(GREEN)},    /* swallow bottom right    */
  253. /*60*/    {'/', "",        C(ORANGE_COLORED)},/* explosion top left     */
  254.     {'-', "",        C(ORANGE_COLORED)},/* explosion top center   */
  255.     {'\\', "",        C(ORANGE_COLORED)},/* explosion top right    */
  256.     {'|', "",        C(ORANGE_COLORED)},/* explosion middle left  */
  257.     {' ', "",        C(ORANGE_COLORED)},/* explosion middle center*/
  258.     {'|', "",        C(ORANGE_COLORED)},/* explosion middle right */
  259.     {'\\', "",        C(ORANGE_COLORED)},/* explosion bottom left  */
  260.     {'-', "",        C(ORANGE_COLORED)},/* explosion bottom center*/
  261.     {'/', "",        C(ORANGE_COLORED)},/* explosion bottom right */
  262. /*
  263.  *  Note: Additions to this array should be reflected in the
  264.  *      {ibm,dec,mac}_graphics[] arrays below.
  265.  */
  266. };
  267.  
  268. #undef C
  269.  
  270. #ifdef ASCIIGRAPH
  271. static uchar ibm_graphics[MAXPCHARS] = {
  272. /* 0*/    g_FILLER(S_stone),
  273.     0xb3,    /* S_vwall:    meta-3, vertical rule */
  274.     0xc4,    /* S_hwall:    meta-D, horizontal rule */
  275.     0xda,    /* S_tlcorn:    meta-Z, top left corner */
  276.     0xbf,    /* S_trcorn:    meta-?, top right corner */
  277.     0xc0,    /* S_blcorn:    meta-@, bottom left */
  278.     0xd9,    /* S_brcorn:    meta-Y, bottom right */
  279.     0xc5,    /* S_crwall:    meta-E, cross */
  280.     0xc1,    /* S_tuwall:    meta-A, T up */
  281.     0xc2,    /* S_tdwall:    meta-B, T down */
  282. /*10*/    0xb4,    /* S_tlwall:    meta-4, T left */
  283.     0xc3,    /* S_trwall:    meta-C, T right */
  284.     0xfa,    /* S_ndoor:    meta-z, centered dot */
  285.     0xfe,    /* S_vodoor:    meta-~, small centered square */
  286.     0xfe,    /* S_hodoor:    meta-~, small centered square */
  287.     g_FILLER(S_vcdoor),
  288.     g_FILLER(S_hcdoor),
  289.     0xfa,    /* S_room:    meta-z, centered dot */
  290.     0xb0,    /* S_corr:    meta-0, light shading */
  291.     0xb1,    /* S_litcorr:    meta-1, medium shading */
  292. /*20*/    g_FILLER(S_upstair),
  293.     g_FILLER(S_dnstair),
  294.     g_FILLER(S_upladder),
  295.     g_FILLER(S_dnladder),
  296.     g_FILLER(S_trap),
  297.     g_FILLER(S_web),
  298.     g_FILLER(S_altar),
  299.     g_FILLER(S_throne),
  300.     g_FILLER(S_sink),
  301.     0xf4,   /* S_fountain:  meta-t, integral top half */
  302. /*30*/    0xf7,    /* S_pool:    meta-w, approx. equals */
  303.     0xfa,    /* S_ice:    meta-z, centered dot */
  304.     0xf7,    /* S_lava:    meta-w, approx. equals */
  305.     0xfa,    /* S_vodbridge:    meta-z, centered dot */
  306.     0xfa,    /* S_hodbridge:    meta-z, centered dot */
  307.     g_FILLER(S_vcdbridge),
  308.     g_FILLER(S_hcdbridge),
  309.     g_FILLER(S_air),
  310.     g_FILLER(S_cloud),
  311.     0xf7,    /* S_water:    meta-w, approx. equals */
  312. /*40*/    0xb3,   /* S_vbeam:     meta-3, vertical rule */
  313.     0xc4,    /* S_hbeam:    meta-D, horizontal rule */
  314.     g_FILLER(S_lslant),
  315.     g_FILLER(S_rslant),
  316.     g_FILLER(S_digbeam),
  317.     g_FILLER(S_flashbeam),
  318.     g_FILLER(S_boomleft),
  319.     g_FILLER(S_boomright),
  320.     g_FILLER(S_ss1),
  321.     g_FILLER(S_ss2),
  322. /*50*/    g_FILLER(S_ss3),
  323.     g_FILLER(S_ss4),
  324.     g_FILLER(S_sw_tl),
  325.     g_FILLER(S_sw_tc),
  326.     g_FILLER(S_sw_tr),
  327.     0xb3,    /* S_sw_ml:    meta-3, vertical rule */
  328.     0xb3,    /* S_sw_mr:    meta-3, vertical rule */
  329.     g_FILLER(S_sw_bl),
  330.     g_FILLER(S_sw_bc),
  331.     g_FILLER(S_sw_br),
  332. /*60*/    g_FILLER(S_explode1),
  333.     g_FILLER(S_explode2),
  334.     g_FILLER(S_explode3),
  335.     0xb3,    /* S_explode4:    meta-3, vertical rule */
  336.     g_FILLER(S_explode5),
  337.     0xb3,    /* S_explode6:    meta-3, vertical rule */
  338.     g_FILLER(S_explode7),
  339.     g_FILLER(S_explode8),
  340.     g_FILLER(S_explode9)
  341. };
  342. #endif  /* ASCIIGRAPH */
  343.  
  344. #ifdef TERMLIB
  345. void NDECL((*decgraphics_mode_callback)) = 0;  /* set in tty_start_screen() */
  346.  
  347. static uchar dec_graphics[MAXPCHARS] = {
  348. /* 0*/    g_FILLER(S_stone),
  349.     0xf8,    /* S_vwall:    meta-x, vertical rule */
  350.     0xf1,    /* S_hwall:    meta-q, horizontal rule */
  351.     0xec,    /* S_tlcorn:    meta-l, top left corner */
  352.     0xeb,    /* S_trcorn:    meta-k, top right corner */
  353.     0xed,    /* S_blcorn:    meta-m, bottom left */
  354.     0xea,    /* S_brcorn:    meta-j, bottom right */
  355.     0xee,    /* S_crwall:    meta-n, cross */
  356.     0xf6,    /* S_tuwall:    meta-v, T up */
  357.     0xf7,    /* S_tdwall:    meta-w, T down */
  358. /*10*/    0xf5,    /* S_tlwall:    meta-u, T left */
  359.     0xf4,    /* S_trwall:    meta-t, T right */
  360.     0xfe,    /* S_ndoor:    meta-~, centered dot */
  361.     0xe1,    /* S_vodoor:    meta-a, solid block */
  362.     0xe1,    /* S_hodoor:    meta-a, solid block */
  363.     g_FILLER(S_vcdoor),
  364.     g_FILLER(S_hcdoor),
  365.     0xfe,    /* S_room:    meta-~, centered dot */
  366.     g_FILLER(S_corr),
  367.     g_FILLER(S_litcorr),
  368. /*20*/    g_FILLER(S_upstair),
  369.     g_FILLER(S_dnstair),
  370.     g_FILLER(S_upladder),
  371.     g_FILLER(S_dnladder),
  372.     g_FILLER(S_trap),
  373.     g_FILLER(S_web),    /* 0xbd, /* \E)3: meta-=, int'l currency */
  374.     g_FILLER(S_altar),    /* 0xc3, /* \E)3: meta-C, dagger */
  375.     g_FILLER(S_throne),
  376.     g_FILLER(S_sink),
  377.     g_FILLER(S_fountain),   /* 0xdb, /* \E)3: meta-[, integral top half */
  378. /*30*/    0xe0,    /* S_pool:    meta-\, diamond */
  379.     0xfe,    /* S_ice:    meta-~, centered dot */
  380.     0xe0,    /* S_lava:    meta-\, diamond */
  381.     0xfe,    /* S_vodbridge:    meta-~, centered dot */
  382.     0xfe,    /* S_hodbridge:    meta-~, centered dot */
  383.     g_FILLER(S_vcdbridge),
  384.     g_FILLER(S_hcdbridge),
  385.     g_FILLER(S_air),
  386.     g_FILLER(S_cloud),
  387.     0xe0,    /* S_water:    meta-\, diamond */
  388. /*40*/    0xf8,   /* S_vbeam:     meta-x, vertical rule */
  389.     0xf1,    /* S_hbeam:    meta-q, horizontal rule */
  390.     g_FILLER(S_lslant),
  391.     g_FILLER(S_rslant),
  392.     g_FILLER(S_digbeam),
  393.     g_FILLER(S_flashbeam),
  394.     g_FILLER(S_boomleft),
  395.     g_FILLER(S_boomright),
  396.     g_FILLER(S_ss1),
  397.     g_FILLER(S_ss2),
  398. /*50*/    g_FILLER(S_ss3),
  399.     g_FILLER(S_ss4),
  400.     g_FILLER(S_sw_tl),
  401.     0xef,    /* S_sw_tc:    meta-o, high horizontal line */
  402.     g_FILLER(S_sw_tr),
  403.     0xf8,    /* S_sw_ml:    meta-x, vertical rule */
  404.     0xf8,    /* S_sw_mr:    meta-x, vertical rule */
  405.     g_FILLER(S_sw_bl),
  406.     0xf3,    /* S_sw_bc:    meta-s, low horizontal line */
  407.     g_FILLER(S_sw_br),
  408. /*60*/    g_FILLER(S_explode1),
  409.     0xef,    /* S_explode2:    meta-o, high horizontal line */
  410.     g_FILLER(S_explode3),
  411.     0xf8,    /* S_explode4:    meta-x, vertical rule */
  412.     g_FILLER(S_explode5),
  413.     0xf8,    /* S_explode6:    meta-x, vertical rule */
  414.     g_FILLER(S_explode7),
  415.     0xf3,    /* S_explode8:    meta-s, low horizontal line */
  416.     g_FILLER(S_explode9)
  417. };
  418. #endif  /* TERMLIB */
  419.  
  420. #ifdef MAC_GRAPHICS_ENV
  421. static uchar mac_graphics[MAXPCHARS] = {
  422. /* 0*/    g_FILLER(S_stone),
  423.     0xba,    /* S_vwall */
  424.     0xcd,    /* S_hwall */
  425.     0xc9,    /* S_tlcorn */
  426.     0xbb,    /* S_trcorn */
  427.     0xc8,    /* S_blcorn */
  428.     0xbc,    /* S_brcorn */
  429.     0xce,    /* S_crwall */
  430.     0xca,    /* S_tuwall */
  431.     0xcb,    /* S_tdwall */
  432. /*10*/    0xb9,    /* S_tlwall */
  433.     0xcc,    /* S_trwall */
  434.     0xb0,    /* S_ndoor */
  435.     0xee,    /* S_vodoor */
  436.     0xee,    /* S_hodoor */
  437.     0xef,    /* S_vcdoor */
  438.     0xef,    /* S_hcdoor */
  439.     g_FILLER(S_Room),
  440.     0xB0,    /* S_corr */
  441.     g_FILLER(S_litcorr),
  442. /*20*/    g_FILLER(S_upstair),
  443.     g_FILLER(S_dnstair),
  444.     g_FILLER(S_upladder),
  445.     g_FILLER(S_dnladder),
  446.     g_FILLER(S_trap),
  447.     g_FILLER(S_web),
  448.     g_FILLER(S_altar),
  449.     g_FILLER(S_throne),
  450.     g_FILLER(S_sink),
  451.     g_FILLER(S_fountain),
  452. /*30*/    0xe0,
  453.     g_FILLER(S_ice),
  454.     g_FILLER(S_lava),
  455.     g_FILLER(S_vodbridge),
  456.     g_FILLER(S_hodbridge),
  457.     g_FILLER(S_vcdbridge),
  458.     g_FILLER(S_hcdbridge),
  459.     g_FILLER(S_air),
  460.     g_FILLER(S_cloud),
  461.     g_FILLER(S_water),
  462. /*40*/    g_FILLER(S_vbeam),
  463.     g_FILLER(S_hbeam),
  464.     g_FILLER(S_lslant),
  465.     g_FILLER(S_rslant),
  466.     g_FILLER(S_digbeam),
  467.     g_FILLER(S_flashbeam),
  468.     g_FILLER(S_boomleft),
  469.     g_FILLER(S_boomright),
  470.     g_FILLER(S_ss1),
  471.     g_FILLER(S_ss2),
  472. /*50*/    g_FILLER(S_ss3),
  473.     g_FILLER(S_ss4),
  474.     g_FILLER(S_sw_tl),
  475.     g_FILLER(S_sw_tc),
  476.     g_FILLER(S_sw_tr),
  477.     g_FILLER(S_sw_ml),
  478.     g_FILLER(S_sw_mr),
  479.     g_FILLER(S_sw_bl),
  480.     g_FILLER(S_sw_bc),
  481.     g_FILLER(S_sw_br),
  482. /*60*/    g_FILLER(S_explode1),
  483.     g_FILLER(S_explode2),
  484.     g_FILLER(S_explode3),
  485.     g_FILLER(S_explode4),
  486.     g_FILLER(S_explode5),
  487.     g_FILLER(S_explode6),
  488.     g_FILLER(S_explode7),
  489.     g_FILLER(S_explode8),
  490.     g_FILLER(S_explode9)
  491. };
  492. #endif  /* MAC_GRAPHICS_ENV */
  493.  
  494. /*
  495.  * Convert the given character to an object class.  If the character is not
  496.  * recognized, then MAXOCLASSES is returned.  Used in invent.c, options.c,
  497.  * pickup.c, sp_lev.c, and lev_main.c.
  498.  */
  499. int
  500. def_char_to_objclass(ch)
  501.     char ch;
  502. {
  503.     int i;
  504.     for (i = 1; i < MAXOCLASSES; i++)
  505.     if (ch == def_oc_syms[i]) break;
  506.     return i;
  507. }
  508.  
  509. /*
  510.  * Convert a character into a monster class.  This returns the _first_
  511.  * match made.  If there are are no matches, return MAXMCLASSES.
  512.  */
  513. int
  514. def_char_to_monclass(ch)
  515.     char ch;
  516. {
  517.     int i;
  518.     for (i = 1; i < MAXMCLASSES; i++)
  519.     if (def_monsyms[i] == ch) break;
  520.     return i;
  521. }
  522.  
  523. void
  524. assign_graphics(graph_chars, glth)
  525. register uchar *graph_chars;
  526. register int glth;
  527. {
  528.     register int i;
  529.  
  530.     for (i = 0; i < MAXPCHARS; i++)
  531.     showsyms[i] = (((i < glth) && graph_chars[i]) ?
  532.                graph_chars[i] : defsyms[i].sym);
  533. }
  534.  
  535. void
  536. switch_graphics(gr_set_flag)
  537. int gr_set_flag;
  538. {
  539.     switch (gr_set_flag) {
  540.     default:
  541.     case ASCII_GRAPHICS:
  542.         assign_graphics((uchar *)0, 0);
  543.         break;
  544. #ifdef ASCIIGRAPH
  545.     case IBM_GRAPHICS:
  546. /*
  547.  * Use the nice IBM Extended ASCII line-drawing characters (codepage 437).
  548.  *
  549.  * OS/2 defaults to a multilingual character set (codepage 850, corresponding
  550.  * to the ISO 8859 character set.  We should probably do a VioSetCp() call to
  551.  * set the codepage to 437.
  552.  */
  553.         flags.IBMgraphics = TRUE;
  554.         flags.DECgraphics = FALSE;
  555.         assign_graphics(ibm_graphics, SIZE(ibm_graphics));
  556.         break;
  557. #endif /* ASCIIGRAPH */
  558. #ifdef TERMLIB
  559.     case DEC_GRAPHICS:
  560. /*
  561.  * Use the VT100 line drawing character set.
  562.  */
  563.         flags.DECgraphics = TRUE;
  564.         flags.IBMgraphics = FALSE;
  565.         assign_graphics(dec_graphics, SIZE(dec_graphics));
  566.         if (decgraphics_mode_callback) (*decgraphics_mode_callback)();
  567.         break;
  568. #endif /* TERMLIB */
  569. #ifdef MAC_GRAPHICS_ENV
  570.     case MAC_GRAPHICS:
  571.         assign_graphics(mac_graphics, SIZE(mac_graphics));
  572.         break;
  573. #endif
  574.     }
  575.     return;
  576. }
  577.  
  578.  
  579. #ifdef REINCARNATION
  580.  
  581. /*
  582.  * saved display symbols for objects & features.
  583.  */
  584. static uchar save_oc_syms[MAXOCLASSES] = DUMMY;
  585. static uchar save_showsyms[MAXPCHARS]  = DUMMY;
  586. static uchar save_monsyms[MAXPCHARS]   = DUMMY;
  587.  
  588. static const uchar r_oc_syms[MAXOCLASSES] = {
  589. /* 0*/    '\0',
  590.     ILLOBJ_SYM,
  591.     WEAPON_SYM,
  592.     ']',            /* armor */
  593.     RING_SYM,
  594. /* 5*/    ',',            /* amulet */
  595.     TOOL_SYM,
  596.     ':',            /* food */
  597.     POTION_SYM,
  598.     SCROLL_SYM,
  599. /*10*/    SPBOOK_SYM,
  600.     WAND_SYM,
  601.     GEM_SYM,        /* gold -- yes it's the same as gems */
  602.     GEM_SYM,
  603.     ROCK_SYM,
  604. /*15*/    BALL_SYM,
  605.     CHAIN_SYM,
  606.     VENOM_SYM
  607. };
  608.  
  609. # ifdef ASCIIGRAPH
  610. static const uchar IBM_r_oc_syms[MAXOCLASSES] = {    /* a la EPYX Rogue */
  611. /* 0*/    '\0',
  612.     ILLOBJ_SYM,
  613.     0x18,            /* weapon: up arrow */
  614. /*    0x0a, */ ARMOR_SYM,    /* armor:  Vert rect with o */
  615. /*    0x09, */ RING_SYM,    /* ring:   circle with arrow */
  616. /* 5*/    0x0c,            /* amulet: "female" symbol */
  617.     TOOL_SYM,
  618.     0x05,            /* food:   club (as in cards) */
  619.     0xad,            /* potion: upside down '!' */
  620.     0x0e,            /* scroll: musical note */
  621. /*10*/    SPBOOK_SYM,
  622.     0xe7,            /* wand:   greek tau */
  623.     0x0f,            /* gold:   yes it's the same as gems */
  624.     0x0f,            /* gems:   fancy '*' */
  625.     ROCK_SYM,
  626. /*15*/    BALL_SYM,
  627.     CHAIN_SYM,
  628.     VENOM_SYM
  629. };
  630. # endif /* ASCIIGRAPH */
  631.  
  632. void
  633. assign_rogue_graphics(is_rlevel)
  634. boolean is_rlevel;
  635. {
  636.     /* Adjust graphics display characters on Rogue levels */
  637.  
  638.     if (is_rlevel) {
  639.     register int i;
  640.  
  641.     (void) memcpy((genericptr_t)save_showsyms,
  642.               (genericptr_t)showsyms, sizeof showsyms);
  643.     (void) memcpy((genericptr_t)save_oc_syms,
  644.               (genericptr_t)oc_syms, sizeof oc_syms);
  645.     (void) memcpy((genericptr_t)save_monsyms,
  646.               (genericptr_t)monsyms, sizeof monsyms);
  647.  
  648.     /* Use a loop: char != uchar on some machines. */
  649.     for (i = 0; i < MAXMCLASSES; i++)
  650.         monsyms[i] = def_monsyms[i];
  651.     for (i = 0; i < MAXPCHARS; i++)
  652.         showsyms[i] = defsyms[i].sym;
  653.  
  654. /*
  655.  * Some day if these rogue showsyms get much more extensive than this,
  656.  * we may want to create r_showsyms, and IBM_r_showsyms arrays to hold
  657.  * all of this info and to simply initialize it via a for() loop like r_oc_syms.
  658.  */
  659.  
  660. # ifdef ASCIIGRAPH
  661.     if (!flags.IBMgraphics) {
  662. # endif
  663.         showsyms[S_vodoor]  = showsyms[S_hodoor]  = showsyms[S_ndoor] = '+';
  664.         showsyms[S_upstair] = showsyms[S_dnstair] = '%';
  665. # ifdef ASCIIGRAPH
  666.     } else {
  667.         /* a la EPYX Rogue */
  668.         showsyms[S_vwall]   = 0xba; /* all walls now use    */
  669.         showsyms[S_hwall]   = 0xcd; /* double line graphics    */
  670.         showsyms[S_tlcorn]  = 0xc9;
  671.         showsyms[S_trcorn]  = 0xbb;
  672.         showsyms[S_blcorn]  = 0xc8;
  673.         showsyms[S_brcorn]  = 0xbc;
  674.         showsyms[S_crwall]  = 0xce;
  675.         showsyms[S_tuwall]  = 0xca;
  676.         showsyms[S_tdwall]  = 0xcb;
  677.         showsyms[S_trwall]  = 0xcc;
  678.         showsyms[S_tlwall]  = 0xb9;
  679.         showsyms[S_corr]    = 0xb1;
  680.         showsyms[S_litcorr] = 0xb2;
  681.         showsyms[S_upstair] = 0xf0; /* Greek Xi */
  682.         showsyms[S_dnstair] = 0xf0;
  683.         showsyms[S_trap]    = 0x04; /* diamond (cards) */
  684.         showsyms[S_vodoor]  = 0xce;
  685.         showsyms[S_hodoor]  = 0xce;
  686.         showsyms[S_ndoor]   = 0xce;
  687.     }
  688. #endif /* ASCIIGRAPH */
  689.  
  690.     for (i = 0; i < MAXOCLASSES; i++) {
  691. #ifdef ASCIIGRAPH
  692.         if (flags.IBMgraphics)
  693.         oc_syms[i] = IBM_r_oc_syms[i];
  694.         else
  695. #endif /* ASCIIGRAPH */
  696.         oc_syms[i] = r_oc_syms[i];
  697.     }
  698.  
  699.     } else {
  700.     (void) memcpy((genericptr_t)showsyms,
  701.               (genericptr_t)save_showsyms, sizeof showsyms);
  702.     (void) memcpy((genericptr_t)oc_syms,
  703.               (genericptr_t)save_oc_syms, sizeof oc_syms);
  704.     (void) memcpy((genericptr_t)monsyms,
  705.               (genericptr_t)save_monsyms, sizeof monsyms);
  706.     }
  707. }
  708. #endif /* REINCARNATION */
  709.  
  710. /*drawing.c*/
  711.